Skip to main content

Minitest

In the steps below, we'll start with a Ruby project that has an existing minitest test suite, and we'll add JUnit XML as an additional output format for the test suite. In each step, we'll show the Git diff for the change that we're making.

  1. Add minitest-ci as a dependency.

    bundle add minitest-ci

    Verify that your Gemfile file includes the new dependency:

    ruby '2.7.4'

    gem 'minitest'
    +gem 'minitest-ci'
    gem 'rake'
  2. Require minitest/ci in your tests. Find where you're currently requiring minitest (such as test/test_helper.rb in the example below) and update it to require minitest/ci as well.

    require 'minitest/autorun'
    +require 'minitest/ci'
  3. minitest-ci writes the JUnit reports to a test/reports directory at the root of your project. Update your .gitignore file so that the reports don't get accidentally checked into the repository.

    /.bundle
    +/test/reports
  4. Commit these changes to your repository.

    git commit -am "Generate JUnit XML test reports with minitest-ci"

    The final result of these changes should resemble commit ff08dc8 in the buildpulse-example-ruby-minitest repository.